Optimal. Leaf size=41 \[ -a x-\frac {a \tanh ^{-1}(\cos (c+d x))}{d}+\frac {a \cos (c+d x)}{d}-\frac {a \cot (c+d x)}{d} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.04, antiderivative size = 41, normalized size of antiderivative = 1.00, number of steps
used = 7, number of rules used = 6, integrand size = 19, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.316, Rules used = {2789, 2672,
327, 212, 3554, 8} \begin {gather*} \frac {a \cos (c+d x)}{d}-\frac {a \cot (c+d x)}{d}-\frac {a \tanh ^{-1}(\cos (c+d x))}{d}-a x \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 8
Rule 212
Rule 327
Rule 2672
Rule 2789
Rule 3554
Rubi steps
\begin {align*} \int \cot ^2(c+d x) (a+a \sin (c+d x)) \, dx &=\int \left (a \cos (c+d x) \cot (c+d x)+a \cot ^2(c+d x)\right ) \, dx\\ &=a \int \cos (c+d x) \cot (c+d x) \, dx+a \int \cot ^2(c+d x) \, dx\\ &=-\frac {a \cot (c+d x)}{d}-a \int 1 \, dx-\frac {a \text {Subst}\left (\int \frac {x^2}{1-x^2} \, dx,x,\cos (c+d x)\right )}{d}\\ &=-a x+\frac {a \cos (c+d x)}{d}-\frac {a \cot (c+d x)}{d}-\frac {a \text {Subst}\left (\int \frac {1}{1-x^2} \, dx,x,\cos (c+d x)\right )}{d}\\ &=-a x-\frac {a \tanh ^{-1}(\cos (c+d x))}{d}+\frac {a \cos (c+d x)}{d}-\frac {a \cot (c+d x)}{d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [C] Result contains higher order function than in optimal. Order 5 vs. order 3 in
optimal.
time = 0.03, size = 75, normalized size = 1.83 \begin {gather*} \frac {a \cos (c+d x)}{d}-\frac {a \cot (c+d x) \, _2F_1\left (-\frac {1}{2},1;\frac {1}{2};-\tan ^2(c+d x)\right )}{d}-\frac {a \log \left (\cos \left (\frac {1}{2} (c+d x)\right )\right )}{d}+\frac {a \log \left (\sin \left (\frac {1}{2} (c+d x)\right )\right )}{d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.12, size = 49, normalized size = 1.20
method | result | size |
derivativedivides | \(\frac {a \left (\cos \left (d x +c \right )+\ln \left (\csc \left (d x +c \right )-\cot \left (d x +c \right )\right )\right )+a \left (-\cot \left (d x +c \right )-d x -c \right )}{d}\) | \(49\) |
default | \(\frac {a \left (\cos \left (d x +c \right )+\ln \left (\csc \left (d x +c \right )-\cot \left (d x +c \right )\right )\right )+a \left (-\cot \left (d x +c \right )-d x -c \right )}{d}\) | \(49\) |
risch | \(-a x +\frac {a \,{\mathrm e}^{i \left (d x +c \right )}}{2 d}+\frac {a \,{\mathrm e}^{-i \left (d x +c \right )}}{2 d}-\frac {2 i a}{d \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right )}-\frac {a \ln \left ({\mathrm e}^{i \left (d x +c \right )}+1\right )}{d}+\frac {a \ln \left ({\mathrm e}^{i \left (d x +c \right )}-1\right )}{d}\) | \(91\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.51, size = 54, normalized size = 1.32 \begin {gather*} -\frac {2 \, {\left (d x + c + \frac {1}{\tan \left (d x + c\right )}\right )} a - a {\left (2 \, \cos \left (d x + c\right ) - \log \left (\cos \left (d x + c\right ) + 1\right ) + \log \left (\cos \left (d x + c\right ) - 1\right )\right )}}{2 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [B] Leaf count of result is larger than twice the leaf count of optimal. 84 vs.
\(2 (41) = 82\).
time = 0.37, size = 84, normalized size = 2.05 \begin {gather*} -\frac {a \log \left (\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) \sin \left (d x + c\right ) - a \log \left (-\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) \sin \left (d x + c\right ) + 2 \, a \cos \left (d x + c\right ) + 2 \, {\left (a d x - a \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{2 \, d \sin \left (d x + c\right )} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} a \left (\int \sin {\left (c + d x \right )} \cot ^{2}{\left (c + d x \right )}\, dx + \int \cot ^{2}{\left (c + d x \right )}\, dx\right ) \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 108 vs.
\(2 (41) = 82\).
time = 4.23, size = 108, normalized size = 2.63 \begin {gather*} -\frac {6 \, {\left (d x + c\right )} a - 6 \, a \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) \right |}\right ) - 3 \, a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + \frac {2 \, a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 3 \, a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 10 \, a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 3 \, a}{\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}}{6 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 6.91, size = 108, normalized size = 2.63 \begin {gather*} \frac {2\,a\,\mathrm {atan}\left (\frac {\sqrt {2}\,\left (\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )-\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )}{2\,\cos \left (\frac {c}{2}-\frac {\pi }{4}+\frac {d\,x}{2}\right )}\right )+a\,\ln \left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d}-\frac {a\,\cos \left (c+d\,x\right )-\frac {a\,\sin \left (2\,c+2\,d\,x\right )}{2}}{d\,\sin \left (c+d\,x\right )} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________